<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    protected function ok($msg,$data=array())
    {
        return response()->json([
            'code' => '1',
            'msg' => $msg,
            'data' => $data
        ]);
    }
    protected function err($msg)
    {
        return response()->json([
            'code' => '2',
            'msg' => $msg
        ]);
    }
    protected function list($tree)
    {
        return response()->json([
            'msg' => "操作成功！",
            'code' => "0",
            'data' => $tree,
            'count' => count($tree),
            'is' => true,
            'tip' => "操作成功！"
        ]);
    }
}
